#ifndef FOREGROUNDOBSERVER_H_
#define FOREGROUNDOBSERVER_H_

#include <e32base.h>
#include <APGWGNAM.H>
#include <APGTASK.H>
#include <COEMAIN.H>
#include <aknglobalnote.h>

class CForegroundObserver : public CActive
{
	public:
		/**
		 * This function starts the monitoring
		 * @return - NONE
		 * */
		void Start();
		
		/**
		 * This function stops the monitoring
		 * @return - NONE 
		 * */
		void Stop();
		
		/**
		 * This function is called by the platform upon completion of an asynchronous request
		 * @return - NONE
		 * */
		void RunL();
		
		/**
		 * This function is called by the platform to cancel any asynchronous request
		 * @return - NONE
		 * */
		void DoCancel();
		
		/**
		 * Symbian style constructor
		 * @return - NONE
		 * */
		static CForegroundObserver* NewL();
		
		/**
		 * This function is called with the UID of the current foreground application
		 * @return - NONE
		 * */
		void ForegroundEventL(TUid);
		
		/**
		 * Destructor
		 * @return - NONE
		 * */
		~CForegroundObserver();
		
		/**
		 * This function simulates the RED key on the device
		 * @return - NONE
		 * */
		void SimulateKey();

		/**
		 * This function simulates the RED key on the device
		 * @return - NONE
		 * */
		void SimulateKey(TInt aScanCode);
		
	private:
		
		/**
		 * Constructor
		 * @return - NONE
		 * */
		CForegroundObserver();
		
		/**
		 * Second level constructor
		 * @return - NONE
		 * */
		void ConstructL();
		
	private:
		RWsSession iWsSession;
		RWindowGroup* iWindowGroup;
		TInt iHandle;
};
#endif /*FOREGROUNDOBSERVER_H_*/
